self_update
self_update
provides updaters for updating rust executables in-place from various release
distribution backends.
Usage
Update (replace) the current executable with the latest release downloaded
from https://api.github.com/repos/jaemk/self_update/releases/latest
.
Note, the trust
project provides a nice setup for
producing release-builds via CI (travis/appveyor).
Features
The following cargo features are available (but disabled by default):
archive-tar
: Support for tar archive format;archive-zip
: Support for zip archive format;compression-flate2
: Support for gzip compression;compression-zip-deflate
: Support for zip's deflate compression format;compression-zip-bzip2
: Support for zip's bzip2 compression format;rustls
: Use pure rust TLS implementation for network requests. This feature does not support 32bit macOS;signatures
: Use zipsign to verify.zip
and.tar.gz
artifacts. Artifacts are assumed to have been signed using zipsign.
Please activate the feature(s) needed by your release files.
Example
Run the following example to see self_update
in action:
cargo run --example github --features "archive-tar archive-zip compression-flate2 compression-zip-deflate"
.
There's also an equivalent example for gitlab:
cargo run --example gitlab --features "archive-tar archive-zip compression-flate2 compression-zip-deflate"
.
which runs something roughly equivalent to:
use cargo_crate_version;
Amazon S3, Google GCS, and DigitalOcean Spaces are also supported through the S3
backend to check for new releases. Provided a bucket_name
and asset_prefix
string, self_update
will look up all matching files using the following format
as a convention for the filenames: [directory/]<asset name>-<semver>-<platform/target>.<extension>
.
Leading directories will be stripped from the file name allowing the use of subdirectories in the S3 bucket,
and any file not matching the format, or not matching the provided prefix string, will be ignored.
use cargo_crate_version;
Separate utilities are also exposed (NOTE: the following example requires the archive-tar
feature,
see the features section above). The self_replace
crate is re-exported for convenience:
License: MIT